package com.study.javaOther.recommend_system;

import java.io.Serializable;

/**
 * 用于存储实体类
 *
 * @author think
 */
public class Item implements Serializable, Comparable<Item> {
    int id;
    float movieRating;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public float getMovieRating() {
        return movieRating;
    }

    public void setMovieRating(float movieRating) {
        this.movieRating = movieRating;
    }

    public Item(int id, float movieRating) {
        super();
        this.id = id;
        this.movieRating = movieRating;
    }

    @Override
    public String toString() {
        return "Item [id=" + id + ", movieRating=" + movieRating + "]\n";
    }

    @Override
    public int compareTo(Item o) {
        return (int) (o.getMovieRating() * 100000000 - this.movieRating * 100000000);
    }

}
